import urllib
from urllib.request import urlopen

if __name__ == "__main__":
    # 编码
    encode_url = urllib.request.quote("https://www.w3cschool.cn/")
    print(encode_url)

    # 解码
    uncode_url = urllib.request.unquote(encode_url)
    print(uncode_url)